package com.zzyl.mapper;

import com.github.pagehelper.Page;
import com.zzyl.dto.CustomerReservationPageParamDto;
import com.zzyl.entity.CustomerReservation;
import com.zzyl.vo.CustomerReservationVo;
import com.zzyl.vo.ReservationTimeVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDateTime;
import java.util.List;


@Mapper
public interface CustomerReservationMapper {
    //查询取消预约次数
    Long selectCancelCount(Long userId,LocalDateTime start,LocalDateTime end);

    //查询时间段剩余次数
    List<ReservationTimeVo> selectTimeCount(LocalDateTime start, LocalDateTime end);

    //查询该时间段已有预约，返回数量
    Long selectByTime(@Param("mobile") String mobile, @Param("time") LocalDateTime time);

    //新增预约
    void insertReservation(CustomerReservation customerReservation);

    //分页查询
    Page<CustomerReservationVo> selectByPage(@Param("status") Integer status
                                            ,@Param("userId") Long userId);

    //查询状态
    Integer selectStatus(Long id);

    //取消订单
    void updateStatus(Long id);

    //查询所有
    List<CustomerReservation> selectAll();

    //自动更新预约状态为已过期
    void autoUpdate(Long id);
}
